﻿using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace KeyloggerProject.KlientKeyloggera
{
    public partial class FileBrowser : Form
    {
        public FileBrowser()
        {
            InitializeComponent();
        }

        private void FileBrowser_Load(object sender, EventArgs e)
        {
            string[] s=Directory.GetLogicalDrives();
            for (int i = 0; i < s.Length; i++)
            {
                comboBox1.Items.Add(s[i]);
            }
            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = 0;
            }
            try
            {
                DirectoryInfo di = new DirectoryInfo(comboBox1.Items[comboBox1.SelectedIndex].ToString());
                DirectoryInfo[] ditam = di.GetDirectories();
                FileInfo[] filetab = di.GetFiles();
                for(int i=0;i<ditam.Length;i++)
                {
                    dataGridView1.Rows.Add(new object[] {ditam[i].Name,"","Folder","Data Modyfikacja powinna być"});
                }
                for (int i = 0; i < filetab.Length; i++)
                {
                    dataGridView1.Rows.Add(new object[] { filetab[i].Name, filetab[i].Length, "Plik", "Data Modyfikacja powinna być" });
                }
            }
            catch (Exception ex)
            {
                Runer.AddException("Klient->FileBrowser: ",ex);
            }
            }
    }
}
